package practice8;

public class Cylinder implements Shape{
    private double radius;
    private double height;

    // 构造方法
    public Cylinder(double radius, double height) {
        this.radius = radius;
        this.height = height;
    }

    // 实现 area() 方法，计算底面积
    @Override
    public double area() {
        return Pi * radius * radius;
    }

    // 实现 volume() 方法，计算体积
    @Override
    public double volume() {
        return area() * height;
    }
}
